package com.hue;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@SuppressWarnings("serial")
public class CountLinks extends HttpServlet {

    @Override
    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    	ArrayList links = (ArrayList) getServletContext().getAttribute(SaveLinks.SAVE_LINKS);
    	resp.getOutputStream().println(links == null ? "0" : String.valueOf(links.size()));
    }

}
